# 引入模块
from urllib import request
from urllib import parse
data_str = parse.urlencode({
    "name": "qiku",
    "address": "东三街"
})
url = f"http://httpbin.org/get?{data_str}"
print(url)

#构建请求参数
req = request.Request(url,headers={
    "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36"
})
print(req.headers)

print("==="*50)
res = request.urlopen(req)
print(res.headers)
print(res.read().decode())
